package com.springcloud.market.stock.service.impl;

import com.springcloud.market.stock.mapper.StockMapper;
import com.springcloud.market.stock.pojo.Stock;
import com.springcloud.market.stock.service.StockService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StockServiceImpl implements StockService {
    @Autowired
    private StockMapper stockMapper;
    @Override
    public void reduce(Integer productId) {
     Stock stock = stockMapper.selectById(productId);
    stock.setCount(stock.getCount()-1);
    stockMapper.updateById(stock);
 }
}
